from flask import Flask, render_template, request, redirect, url_for, make_response, jsonify,send_from_directory

from frameworks.cores.Config import *
from frameworks.utils.RedisUtil import *

server = Flask(__name__)

from gevent import monkey

# 将python标准的io方法，都替换成gevent中的同名方法，遇到io阻塞gevent自动进行协程切换
monkey.patch_all()

def create_app():
    app = Flask(__name__)
    return app


app = create_app()
app.config['JSON_AS_ASCII']=False

basepath = os.path.join(os.path.dirname(__file__))
config = Config(basepath)

apimap = config.getApi()
env = apimap["base"]
print(env)

print(basepath)

@app.route(env,methods=['GET', 'POST'])
def index():
    return render_template('index.html'
                           )

if __name__ == "__main__":
    app.run()
